package com.flex.mobile.util;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * 日期+7位数字
 * @author miao
 *
 */
public class OrderNoGeneratorUtil {
	public static OrderNoGeneratorUtil orderNoGenerator;
	public static long count=1;
	public synchronized static  OrderNoGeneratorUtil getInstance() {
		if(null==orderNoGenerator){
			orderNoGenerator=new OrderNoGeneratorUtil();
		}
		return orderNoGenerator;
	}
	public synchronized static String process(){
		SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
		String dateString="";
		dateString=sdf.format(new Date());
		count=++count;
		String ss=String.format("%07d", count);
		if(ss.length()>7){
			ss=ss.substring(ss.length()-7, ss.length());
		}
		return dateString+ss;
	}
}
